package hapiserverproject;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

import org.fest.swing.edt.FailOnThreadViolationRepaintManager;
import org.fest.swing.edt.GuiActionRunner;
import org.fest.swing.edt.GuiQuery;
import org.fest.swing.fixture.FrameFixture;

public class ArayuzTest {
	
	private FrameFixture window;
	HapiServerGUI tmp;
	
	
	  @BeforeClass
	  public static void  setUpOnce() {
		    FailOnThreadViolationRepaintManager.install();
		  }

	
	@Before 
	public void setUp() {
		HapiServerGUI arayuz_frame = GuiActionRunner.execute(new GuiQuery<HapiServerGUI>() {
			protected HapiServerGUI executeInEDT() {
				return new HapiServerGUI();
	        }
		});
	    window = new FrameFixture(arayuz_frame);
	    window.show(); // shows the frame to test
	    this.tmp = arayuz_frame;
	 }
	        @Test
	public void testStopButton() {
	    window.button("stopButton").click();
	    assertFalse(tmp.checkStatus());
	}
                
	@Test 
	public void testStartButton() {	    
	    window.button("startButton").click();
	    assertTrue(tmp.checkStatus());	    
	}


}
